package com.kit2;

import com.jplus.core.utill.JUtil;
import com.kit.lib.AES;

/**
 * DoorLockKit
 */
public class DoorLockKit {
    {
        // -Djava.library.path=/xxx
        System.loadLibrary("com_kit2_DoorLockKit");
    }

    public native String hello(String key);

    public native byte[] aesEncrypt(byte[] data, byte[] key);

    public native byte[] aesDecrypt(byte[] data, byte[] key);

    public static void main(String[] args) {

        byte[] key = "1234567890123456".getBytes();
        byte[] src = "1234567890abcdefg".getBytes();
        byte[] srd = JUtil.hex2Bytes("444EFE38E96AA7D2E2DE8D945BB96566C7");
        DoorLockKit kit = new DoorLockKit();
        System.out.println("JAVA:" + kit.hello("world,您好~"));

        System.out.println("   C AES Encode: " + JUtil.byte2Hex(kit.aesEncrypt(src, key)));
        System.out.println("Java AES Encode: " + JUtil.byte2Hex(AESUtil.encrypt(src, key)));

        System.out.println("   C AES Decode: " + JUtil.byte2Hex(kit.aesDecrypt(srd, key)));
        System.out.println("Java AES Decode: " + JUtil.byte2Hex(AESUtil.decrypt(srd, key)));

    }

}